package UserUI;

import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import javax.swing.ImageIcon;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;

import RMI.RMIHelper;
import UserBL.UserLogicService;

import vo.TeacherVO;

public class TeacherUI extends JPanel {

	private TeacherSearch ts=new TeacherSearch();
	private TeacherInfo ti=new TeacherInfo(new TeacherVO());
	private RMIHelper rmi;
	private UserLogicService uls;
	/**
	 * Create the panel.
	 */
	public TeacherUI() {
		this.setBounds(0, 0, 1280,725);
		this.setLayout(null);
		this.setVisible(true);
		setOpaque(false);
		ts.setLocation(0, 0);
		ti.setLocation(512,0);
		this.add(ts);
		this.add(ti);
		rmi=new RMIHelper();
		uls=rmi.getUserService();
		ts.table.addMouseListener(new ClickListener());
		ts.table.repaint();
		this.setOpaque(false);
		this.repaint();
	}
	
	
	private class ClickListener implements MouseListener{

		@Override
		public void mouseClicked(MouseEvent e) {
			// TODO Auto-generated method stub
				int row = ts.table.getSelectedRow();
				TeacherVO teacher=new TeacherVO();
				teacher=ts.tvList.get(row);
				ti.showTeacher(teacher);
				ti.repaint();
		}

		@Override
		public void mouseEntered(MouseEvent arg0) {
			// TODO Auto-generated method stub
			
		}

		@Override
		public void mouseExited(MouseEvent arg0) {
			// TODO Auto-generated method stub
			
		}

		@Override
		public void mousePressed(MouseEvent arg0) {
			// TODO Auto-generated method stub
			
		}

		@Override
		public void mouseReleased(MouseEvent arg0) {
			// TODO Auto-generated method stub
			
		}
		
	}

}
